<?php
	require_once 'system/DbService.php';
	
	require_once MODELPATH.'window_properties.php';
	
	$dbService = new DbService();
	
	$wp = new window_properties();
	$wp->name = 'mikail';
	echo $dbService->save($wp, true);
	
	
    $w = new members();
	$criteria = new Criteria($w);
	$criteria->fields("id");
	$criteria->like("", "");
	$criteria->asModel();
	$objlist = $dbservice->select($criteria);

	
	
	/*
     * Criteria fields test with array
     */
	$criteria2 = new Criteria($w);
	$criteria2->fields("id");
	$arrayList = $dbservice->select($criteria2);
	
	/*
     * Criteria fields test with array and where
     */
	$criteria3 = new Criteria($w);
	$criteria3->fields("id");
	$criteria3->where("id<>",5); //id>
	$arrayList2 = $dbservice->select($criteria3);
	
	print_r($objlist);
	echo "<p>####################arraylist1######################</p>";
	print_r($arrayList);
	echo "<p>######################arrayList2###################</p>";
	print_r($arrayList2);
	echo "<p>##########################################</p>";
	
    $dbservice->executeQuery("select * from members");
	  var_dump($dbservice->getQueryResultFetchArray());


	  echo "<p>##########################################</p>";
	/*
     * Criteria fields test with array
     * asModel yokken
     */
	$criteria2 = new Criteria($w);
	$criteria2->sum("id","SONUC");
	$criteria2->asArray();
	$arrayList = $dbservice->select($criteria2);
	print_r($arrayList);
	echo '<br />';
	echo $arrayList[0];
	
	

	//var_dump($obj->get(0)->id);
	
//	
//	$w->name = "Gokalp";
//	$r = $dbservice->save($w);
//	 echo $r;
//	
//	echo "<p></p>****************fetch array***************************<p></p>";
//	
//	/*
//	 * pSQL
//	 */
//	 $dbservice->executeQuery("select * from window_categories");
//	  while($p = $dbservice->getQueryResultFetchArray()){
//	  	 print_r($p);
//	  }
//	  
//	echo "<p></p>******************assoc array*************************<p></p>";
//	$dbservice->executeQuery("select * from window_categories");
//	  while($p = $dbservice->getQueryResultAssocArray()){
//	  	 print_r($p);
//	  }
//	  
//	  echo "<p></p>*******************affected rows************************<p></p>";
//	  
//	  echo $dbservice->getQueryAffectedRows();
//	  
//	   echo "<p></p>*******************escape string************************<p></p>";
//	  
//	  echo $dbservice->setRealEscapeString("gok'alp");
//	  
//	  echo "<p></p>*******************last insert ID************************<p></p>";
//	  
//	  print_r($dbservice->getLastInsertID("window_categories"));
//	
//	
//    $dbservice->connectionClose();
//    
   
	
	
?>